source("plotting.R")
library(tidyverse)

set.seed(456)
distance_rep = read_csv("../distance_balance_plot_main.csv")

#pdistance = save_balance_plot_diffs(distance_rep,"distance",
#                                    b_one = c(5000,25000,75000),l_one = c("5,000","25,000","75,000"),
#                                    b_two = c(1000,5000),l_two = c("1,000","5,000"))
#save_plot("figures_for_paper/a1.pdf", 
#          pdistance, base_height = 16, base_asp = 1.8,device = cairo_pdf)

pdistance = save_balance_plot_diffs_default(distance_rep,"distance",
                                    b_one = c(5000,25000,75000),l_one = c("5,000","25,000","75,000"),
                                    b_two = c(1000,5000),l_two = c("1,000","5,000"))
save_plot("figures_for_replication/a1.pdf", 
          pdistance, base_height = 16, base_asp = 1.8,device = cairo_pdf)


real_estate_distance = read_csv("../distance_real_estate_balance_plot.csv")


#real_d_scatter = plot_real_estate_scatter(real_estate_distance)

#save_plot(paste0("figures_for_paper/a2.pdf"), 
#          real_d_scatter , base_height = 10, base_asp = 1.0,device = cairo_pdf)

real_d_scatter = plot_real_estate_scatter_default(real_estate_distance)

save_plot(paste0("figures_for_replication/a2.pdf"), 
          real_d_scatter , base_height = 10, base_asp = 1.0,device = cairo_pdf)


#real_d_balance = plot_real_estate(real_estate_distance,breaks=c(250,1000,2500),
#                                  labels = c("250","1,000","2,500"))

#save_plot(paste0("figures_for_paper/a3.pdf"), 
#          real_d_balance , base_height = 10, base_asp = 1.0,device = cairo_pdf)

real_d_balance = plot_real_estate_default(real_estate_distance,breaks=c(250,1000,2500),
                                  labels = c("250","1,000","2,500"))

save_plot(paste0("figures_for_replication/a3.pdf"), 
          real_d_balance , base_height = 10, base_asp = 1.0,device = cairo_pdf)


shock_rep = read_csv("../shock_balance_plot_main.csv")

#pshock  = save_balance_plot_diffs(shock_rep,"shock",
#                                  b_one = c(500,2500,12500),l_one = c("500","2,500","12,500"),
#                                  b_two = c(300,600),l_two = c("300","600"))
#save_plot("figures_for_paper/a4.pdf", 
#          pshock, base_height = 16, base_asp = 1.8,device = cairo_pdf)

pshock  = save_balance_plot_diffs_default(shock_rep,"shock",
                                  b_one = c(500,2500,12500),l_one = c("500","2,500","12,500"),
                                  b_two = c(300,600),l_two = c("300","600"))
save_plot("figures_for_replication/a4.pdf", 
          pshock, base_height = 16, base_asp = 1.8,device = cairo_pdf)

real_estate_shock = read_csv("../shock_real_estate_balance_plot.csv")


#real_s_scatter = plot_real_estate_scatter(real_estate_shock)

#save_plot(paste0("figures_for_paper/a5.pdf"), 
#          real_s_scatter , base_height = 10, base_asp = 1.0,device = cairo_pdf)
#

real_s_scatter = plot_real_estate_scatter_default(real_estate_shock)

save_plot(paste0("figures_for_replication/a5.pdf"), 
          real_s_scatter , base_height = 10, base_asp = 1.0,device = cairo_pdf)



#real_s_balance = plot_real_estate(real_estate_shock,breaks=c(100,500),
#                                  labels = c("100","500"))

#save_plot(paste0("figures_for_paper/a6.pdf"), 
#          real_s_balance , base_height = 10, base_asp = 1.0,device = cairo_pdf)

real_s_balance = plot_real_estate_default(real_estate_shock,breaks=c(100,500),
                                  labels = c("100","500"))

save_plot(paste0("figures_for_replication/a6.pdf"), 
          real_s_balance , base_height = 10, base_asp = 1.0,device = cairo_pdf)
